home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / dviware / crudetype / version3 / vms.ch < prev    next >
Text File  |  1991-11-28  |  5KB  |  151 lines

  1. % vms.ch -*-mode: change; webfile: crudetype.web version 3.01;-*-
  2. % Originally, this was nearly empty, but I have now put into this file a lot
  3. % of the most VMS-specific code that was in the WEB file.
  4. %
  5. %
  6.  
  7. % WEAVE: New title
  8. @x  Module 0; Lines 42 -- 42
  9. \pageno=\contentspagenumber \advance\pageno by 1
  10. @y
  11. \pageno=\contentspagenumber \advance\pageno by 1
  12. \def\title{Crudetype for {\mc VMS}}
  13. @z
  14.  
  15. % 11
  16. @x  Module 11; Lines 305 -- 307
  17. @d real_number == real
  18. @d make_real( #) == #
  19.     {convert an integer to a |real_number|. Usually automatic}
  20. @y
  21. @d real_number == double
  22. @d make_real( #) == dble( #)
  23.     {convert an integer to double-length real}
  24. @z
  25.  
  26. % 14
  27. %
  28. @x  Module 14; Lines 360 -- 361
  29. @<Lowest...@>=
  30.   {Declare |parse_file|}
  31. @y
  32. @<Lowest...@>=
  33.   procedure  parse_file( name: var_string; var dir, nam, ex: var_string) ;
  34.   var p,q,r,s: s_ptr ;
  35.   begin
  36.     dir := blank; nam := blank; ex := blank;
  37.     s := name.len ;
  38.     if ( s>0) then begin
  39.       p := s_search( name, ']', -s);
  40.       q := s_search( name, ':', -s);
  41.       if ( q>p) then p := q ;
  42.       if ( p>0) then substring( dir, name, 1, p) ;
  43.       r := s_search( name, '.', -s);
  44.       if ( r>p) then substring( ex, name, r, s-r+1)
  45.       else r := s +1 ;
  46.       substring( nam, name, p+1, r-p-1) ;
  47.     end;
  48.   end;
  49. @z
  50.  
  51. @x  Module 16; Lines 387 -- 388
  52. @ The next few sections contain the lowest level code for file handling. These
  53. macros describe how we use the terminal.
  54. @y
  55. @ The next few sections contain the lowest level code for file handling. These
  56. macros describe how we use the terminal. Here we have to do some messy stuff
  57. to circumvent a bad feature of VMS \PASCAL. VMS opens the terminal channels
  58. automatically, but by default, with a (short) maximum record length. The
  59. effect is that the program crashes on long files.
  60. @z
  61.  
  62. @x  Module 16; Lines 405 -- 406
  63. @d display(#)==write(term_out, #)
  64. @d display_ln(#)==write_ln(term_out, # )
  65. @y
  66. @d display(#)==write_ln(term_out, #)
  67. @d display_ln(#)==write_ln(term_out, #, chr( 13), chr( 10) )
  68.     {effectively makes record length infinite}
  69. @#
  70. @d no_crash == @=error := continue@>
  71. @d close_binary(#)== close(# , no_crash )
  72. @d r_len == @=record_length@>
  73. @d c_con == @=carriage_control@>
  74.   {VMS file-handling eccentricities}
  75. @z
  76.  
  77. @x  Module 16; Lines 416 -- 416
  78. @<Open terminal channels@>= do_nothing
  79. @y
  80. @<Open terminal channels@>=
  81.   open( output, 'SYS$OUTPUT', c_con := none);
  82. @z
  83.  
  84. @x  Module 19; Lines 442 -- 443
  85. @<Lowest...@>=
  86.   {Declare |open_binary|}
  87. @y
  88.  
  89. If the VMS |open| procedure cannot open the file, |no_crash| suppresses the
  90. system error message, and |status| gets some nonzero value.
  91.  
  92. @<Lowest...@>=
  93.   function open_binary
  94.   (var f_f: byte_file; name: var_string ): boolean;
  95.   var s: integer; f_n: filename ;
  96.   begin
  97.     close_binary(f_f );
  98.       {in case the file was left open}
  99.     name_of( f_n,  name) ;
  100.     open(f_f, f_n, readonly, ,, fixed, no_crash );
  101.     s := status(f_f) ;
  102.     if ( s <> 0) then open_binary := false
  103.     else begin
  104.       reset(f_f , no_crash );
  105.       s := status(f_f) ;
  106.       open_binary := (s = 0 );
  107.     end;
  108.   end;
  109. @z
  110.  
  111. @x  Module 20; Lines 445 -- 446
  112. @ @<Open |printfile|@>=
  113.   rewrite(printfile) ;
  114. @y
  115. @ VMS \PASCAL\ allows 3 types of carriage control, called |list|, |fortran|,
  116. or |none|. No doubt other systems will have other peculiar types of carriage
  117. control. In VMS, |none| is to be used if at all possible, but some printers
  118. insist on a line feed after every carriage return. Roughly speaking, |@!list|
  119. directs the operating system to put a CR--LF at the end of each record when
  120. the file is printed. |@!fortran| means that a Fortran-type carriage control
  121. character must be put at the start of each record, and we assume that this
  122. must be inserted explicitly. One type of run-time error that causes a lot of
  123. trouble occurs if you try to write too many characters onto one record of the
  124. |printfile|. I have tried to defeat this by declaring a very long record
  125. length.
  126.  
  127. @<Open |printfile|@>=
  128.   if inspection then
  129.   open (printfile, 'SYS$OUTPUT', c_con := list, r_len := 30000 )
  130.   else if fortran then
  131.   open (printfile, print_name.data, c_con := fortran, r_len := 30000 )
  132.   else if list then
  133.   open(printfile, print_name.data, c_con := list, r_len := 30000 )
  134.   else
  135.   open(printfile, print_name.data, c_con := none, r_len := 30000 ) ;
  136.   rewrite(printfile) ;
  137.  
  138. @z
  139.  
  140. @x  Module 21; Lines 455 -- 458
  141. @d read_command_line( #) == do_nothing
  142.  
  143. @<Lowest...@>=
  144.   {Declare |read_command_line| }
  145. @y
  146. @d read_command_line( #) == @= lib$get_foreign @> ( #)
  147.  
  148. @<Lowest...@>=
  149.   procedure read_command_line( @= %descr @> ss: fix_string); extern ;
  150. @z
  151.